<!DOCTYPE html>
<html>
    <head>
        <title></title>
        <meta charset="UTF-8">
        <link rel="stylesheet" type="text/css" href="<?php echo $this->url->getBaseUri() ?>public/back/Css/bootstrap.css" />
        <link rel="stylesheet" type="text/css" href="<?php echo $this->url->getBaseUri() ?>public/back/Css/bootstrap-responsive.css" />
        <link rel="stylesheet" type="text/css" href="<?php echo $this->url->getBaseUri() ?>public/back/Css/style.css" />
        <script type="text/javascript" src="<?php echo $this->url->getBaseUri() ?>public/back/Js/jquery.js"></script>
        <script type="text/javascript" src="<?php echo $this->url->getBaseUri() ?>public/back/Js/jquery.sorted.js"></script>
        <script type="text/javascript" src="<?php echo $this->url->getBaseUri() ?>public/back/Js/bootstrap.js"></script>
        <script type="text/javascript" src="<?php echo $this->url->getBaseUri() ?>public/back/Js/ckform.js"></script>
        <script type="text/javascript" src="<?php echo $this->url->getBaseUri() ?>public/back/Js/common.js"></script>
        <style type="text/css">
                        body {
                            padding-bottom: 40px;
                        }
                        .sidebar-nav {
                            padding: 9px 0;
                        }
                        @media (max-width: 980px) {
                            /* Enable use of floated navbar text */
                            .navbar-text.pull-right {
                                float: none;
                                padding-left: 5px;
                                padding-right: 5px;
                            }
                        }
        </style>
    </head>
    <body>
        <form  id='frm1' class="form-inline definewidth m20" action='<?php echo $this->url->get('admin/pay')?>/index' method="post">
         状态:<select id='state' name='state'>
                <option value='0' >-------</option>
                <option value='1' >未审核</option>
                <option value='2' >已审核</option>
            </select>
            手机:<input type="text" name="tel" id="tel" class="abc input-default" placeholder="请输入查询条件" value='<?php echo $tel?>'>&nbsp;&nbsp;
            <button type="submit"  id='button1' class="btn btn-primary" name='button1'>查询</button>&nbsp;&nbsp;
            <button  class="btn btn-primary" id='button2'>全部删除</button>&nbsp;&nbsp;
    
            <table class="table table-bordered table-hover definewidth m10" >
                <thead>
                    <tr>
                        <td><input type='checkbox'  id="checkAll"></td>
                        <th>用户手机号</th>
                        <th>银行</th>
                        <th>金额</th>
                        <th>银行流水号</th>
                        <th>充值时间</th>
                        <th>交易号</th>
                        <th>状态</th>
                        <th>操作</th>
                    </tr>
                 <?php foreach($page->items  as $row) {
                     $statu=$row->state;
                        //订单状态判断
                        switch ($statu) {
                            case 1:
                                $statu='没有审核';
                                break;
                            case 2:
                                $statu='审核完毕';
                                break;
                            default:
                                $statu='状态错误';
                                break;
                        }
           
                  ?>
                    <tr class='tdd'>
                        <td><input type='checkbox' name='ids[]' value='<?php echo $row->id;?>'></td>
                        <th><?php echo $row->getUser()->tel;?></th>
                        <th><?php echo $row->bank;?></th>
                        <th><?php echo $row->money;?></th>
                        <th><?php echo $row->serial_num;?></th>
                        <th><?php echo $row->date;?></th>
                        <th><?php echo $row->trade_num;?></th>
                        <th><?php echo $statu;?></th>
                <th>
             <a href='<?php echo $this->url->get('admin/pay')?>/del/<?php echo $row->id;?>/<?php echo $page->current;?>/<?php echo $state;?>/<?php echo $tel;?>'>删除</a>
    <?php 
    if(1 == $row->state){ ?>
            <a href='<?php echo $this->url->get('admin/pay')?>/success/<?php echo $row->id;?>/<?php echo $page->current;?>/<?php echo $state;?>/<?php echo $tel;?>'>确认充值</a>
    <?php }  else{
                echo "已确认充值";
              } ?>
                </th>
                    </tr>
                <?php } ?>
                <tr>
                    <td colspan="11" align="right" style="text-align:right">
                    <a href="<?php echo $this->url->get('admin/pay')?>/index/1/<?php echo $state;?>/<?php echo $tel?>">第一页</a>
                    <a href="<?php echo $this->url->get('admin/pay')?>/index/<?php echo $page->before; ?>/<?php echo $state;?>/<?php echo $tel?>">上一页</a>
                    <a href="<?php echo $this->url->get('admin/pay')?>/index/<?php echo $page->next; ?>/<?php echo $state;?>/<?php echo $tel?>">下一页</a>
                    <a href="<?php echo $this->url->get('admin/pay')?>/index/<?php echo  $page->last; ?>/<?php echo $state;?>/<?php echo $tel?>">最后一页</a>

                    <?php echo "页码 ", $page->current, " 总页数 ", $page->total_pages; ?>
                    </td>
        </tr>
                </thead>
               
            </table>
            </form>
    </body>
</html>
<script>
//遍历状态值改变颜色
$(function() {

    $('.tdd th').each(function(){
      if($(this).text() == "没有审核"){
        $(this).css('color','red');
      }
    });

    $('#state').val('<?php echo $state?>');

    //点击表单“提交”按钮  
   $("#button2").click(function() {  
    var url = "<?php echo $this->url->get('admin/pay')?>/delall/<?php echo $page->current;?>/<?php echo $state;?>/<?php echo $tel;?>";  
    //更改form的action  
   $("#frm1").prop("action", url);  
    //触发submit事件，提交表单   
   $("#frm1").submit();  
});

    $('#checkAll').click(function(){
      if(this.checked){
        $("input[name='ids[]']").prop("checked",true);
      }else{
        $("input[name='ids[]']").prop("checked",false);
      }  
    });
})
</script>